import Vue from 'vue'
import Router from 'vue-router'
import Permission from "./Permission"
import Managements from "./Managements"
import MateriaManage from "./MateriaManage"
import Purchasingmanagement from "./Purchasingmanagement"
import Humanmanage from "./Humanmanage"
import ReplaceList from "./ReplaceList"
import StockManage from "./stockManage"
import ToolManage from "./ToolManage"
import AssetManage from "./AssetManage"

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
}

Vue.use(Router)

let routes = [
  {
    path: '/',
    name: 'login',
    component: () => import( /* webpackChunkName: "login" */ "../Pages/login.vue")
  },
  {
    path: '/register',
    name: 'register',
    component: () => import( /* webpackChunkName: "login" */ "../Pages/register.vue")
  },
  {
    path: '/home',
    name: 'home',
    component: () => import( /* webpackChunkName: "" */ "../Pages/home.vue"),
    children: [
    ]
  }
];
routes[2].children.push(Permission);
routes[2].children.push(Managements);
routes[2].children.push(MateriaManage);
routes[2].children.push(Humanmanage);
routes[2].children.push(Purchasingmanagement);
routes[2].children.push(ReplaceList);
routes[2].children.push(StockManage);
routes[2].children.push(ToolManage);
routes[2].children.push(AssetManage);

export default new Router({
  routes
})
